package com.maiworld.seller.controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.maiworld.content.service.CommentService;
import com.maiworld.pojo.Comment;

import entity.PageResult;
import entity.Result;

@RestController
@RequestMapping("/comment")
public class CommentController {
	
	@Reference
	private CommentService commentService;
	
	/**
	 * 查询
	 * @param comment
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping(value = "/search",method =RequestMethod.POST)
	public PageResult search(@RequestBody Comment comment,@RequestParam("page") int page,@RequestParam("rows") int rows) {
		return commentService.selectByComment(comment, page, rows);
	}
	
	/**
	 * 批量删除 通过数组
	 * @param _idArray
	 * @return
	 */
	@RequestMapping(value = "/deleteCommentByIdArray",method =RequestMethod.POST)
	public Result deleteArticleByIdArray(@RequestBody Long[] _idArray) {
		Result success = new Result(false,"添加失败");		 
		System.out.println(_idArray);
		int row = commentService.deleteByIdArray(_idArray);
		if(row > 0) {
			success.setSuccess(true);
			success.setMessage("删除成功");
		}else {
			
		}
		return success;
	}

}
